package main

import (
	"io"
	"math/rand"
	"os"
	"strconv"
)

func main() {
	var filename = "./output1.txt"
	var f *os.File
	var err1 error
	var writedata string

	f, err1 = os.Create(filename) //创建文件
	if err1 != nil {
		panic(err1)
	}

	io.WriteString(f, "memory_initialization_radix = 16;\r\n") //写入文件(字
	io.WriteString(f, "memory_initialization_vector = ")       //写入文件(字

	for i := 0; i < 10000; i++ {
		if (i % 10) == 0 {
			_, err1 := io.WriteString(f, "\r\n") //写入文件(字
			if err1 != nil {
				panic(err1)
			}
		}
		redint := rand.Intn(256)
		greenint := rand.Intn(256)
		blueint := rand.Intn(256)
		rbbvalue := redint<<16 + greenint<<8 + blueint
		rgbstring := strconv.FormatInt(int64(rbbvalue), 16)

		if i == 9999 {
			writedata = rgbstring + ";"
		} else {
			writedata = rgbstring + ", "
		}
		_, err1 := io.WriteString(f, writedata) //写入文件(字
		if err1 != nil {
			mn
			panic(err1)
		}
	}
}
